import { takeEvery, put } from 'redux-saga/effects';
import * as types from './store/actionTypes';
import {setInitData } from "./store/actionCreators";
import axios from "axios";
function* getInitState() {

    try{
        const res = yield axios.get('./mock/list.json');
        const action = setInitData(res.data);
        yield put(action);
    }catch{
        console.log('出错啦');
    }
}
function* mySaga() {
    yield takeEvery(types.GET_INIT_DATA,getInitState)
}

export default mySaga;